home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / scroll_s / scroll.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-07-26  |  3.8 KB  |  109 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "By Kevin Smith EMAIL: kjsmith@ozemail.com.au"
  5.    ClientHeight    =   4170
  6.    ClientLeft      =   2340
  7.    ClientTop       =   2805
  8.    ClientWidth     =   6690
  9.    Height          =   4575
  10.    Icon            =   "scroll.frx":0000
  11.    Left            =   2280
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   4170
  16.    ScaleWidth      =   6690
  17.    Top             =   2460
  18.    Width           =   6810
  19.    Begin VB.Timer Timer1 
  20.       Left            =   180
  21.       Top             =   3180
  22.    End
  23.    Begin VB.HScrollBar HScroll1 
  24.       Height          =   195
  25.       Left            =   180
  26.       TabIndex        =   2
  27.       Top             =   3960
  28.       Width           =   6375
  29.    End
  30.    Begin VB.PictureBox Picture2 
  31.       Appearance      =   0  'Flat
  32.       AutoRedraw      =   -1  'True
  33.       AutoSize        =   -1  'True
  34.       BackColor       =   &H80000005&
  35.       ForeColor       =   &H80000008&
  36.       Height          =   3285
  37.       Left            =   -120
  38.       Picture         =   "scroll.frx":0442
  39.       ScaleHeight     =   3255
  40.       ScaleWidth      =   19200
  41.       TabIndex        =   1
  42.       Top             =   4560
  43.       Width           =   19230
  44.    End
  45.    Begin VB.PictureBox Picture1 
  46.       Height          =   1935
  47.       Left            =   240
  48.       ScaleHeight     =   217
  49.       ScaleMode       =   0  'User
  50.       ScaleWidth      =   409
  51.       TabIndex        =   0
  52.       Top             =   240
  53.       Width           =   6195
  54.    End
  55.    Begin VB.Label Label3 
  56.       Alignment       =   2  'Center
  57.       BackStyle       =   0  'Transparent
  58.       Height          =   195
  59.       Left            =   600
  60.       TabIndex        =   3
  61.       Top             =   3660
  62.       Width           =   5835
  63.    End
  64. Attribute VB_Name = "Form1"
  65. Attribute VB_Creatable = False
  66. Attribute VB_Exposed = False
  67. Const SRCCOPY = &HCC0020
  68. Const PIXELS = 3
  69. Private Sub Form_Load()
  70. ' Center the Form
  71. Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
  72. ' Set the Scale Mode to PIXELS (3) the modes are:
  73. '0   Indicates that one or more of the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties are set to custom values.
  74. '1   (Default) Twip (1440 twips per logical inch; 567 twips per logical centimeter).
  75. '2   Point (72 points per logical inch).
  76. '3   Pixel (smallest unit of monitor or printer resolution).
  77. '4   Character (horizontal = 120 twips per unit; vertical = 240 twips per unit).
  78. '5   Inch.
  79. '6   Millimeter.
  80. '7   Centimeter.
  81. ' BitBlt uses the PIXEL Mode.....
  82. Picture1.ScaleMode = PIXELS
  83. Picture2.ScaleMode = PIXELS
  84. ' Make Picture1 the same height as Picture2 (217 pixels in this demo)
  85. Picture1.Height = Picture2.Height
  86. ' Make The Maxium Scrolling rate 40 pixels at a time
  87. HScroll1.Max = 40
  88. HScroll1.LargeChange = 2
  89. ' Kick start the Timer
  90. Timer1.Interval = 10
  91. End Sub
  92. Private Sub Label2_Click()
  93. End Sub
  94. Private Sub Timer1_Timer()
  95. Label3.Caption = "Scroll Speed = " & HScroll1
  96. Static x As Integer
  97. Dim AWidth As Integer
  98. Dim rc As Integer ' used for return code for BltBit
  99. ' Calaculate the next x position for picture 2
  100. x = x + HScroll1
  101. If x > Picture2.ScaleWidth Then x = 0
  102. If x > (Picture2.ScaleWidth - Picture1.ScaleWidth) Then
  103.     AWidth = Picture2.ScaleWidth - x
  104.     rc = BitBlt(Picture1.hDC, 0, 0, AWidth, Picture2.ScaleHeight, Picture2.hDC, x, 0, SRCCOPY)
  105.     rc = BitBlt(Picture1.hDC, AWidth, 0, Picture1.ScaleWidth - AWidth, Picture2.ScaleHeight, Picture2.hDC, 0, 0, SRCCOPY)
  106.     rc = BitBlt(Picture1.hDC, 0, 0, Picture1.ScaleWidth, Picture2.ScaleHeight, Picture2.hDC, x, 0, SRCCOPY)
  107. End If
  108. End Sub
  109.